// Copyright (c) Appeon. All rights reserved.
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. 
// You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.

namespace SnapObjects.Data
{
    public class SqlInsertStatement : SqlStatement
    {
        public SqlInsertStatement()
        {
            this.Table = new SqlClause();
            this.Into = new SqlClause();
            this.Values = new SqlClause();
            this.Terminator = new SqlClause();
        }

        public SqlClause Table { get; private set; }

        public SqlClause Into { get; private set; }

        public SqlClause Values { get; private set; }

        public SqlClause Terminator { get; private set; }

        public override SqlStatementType StatementType => SqlStatementType.Insert;

        public override SqlTokenType Type => SqlTokenType.Statement;

        public override void Clear()
        {
            this.Table.Clear();
            this.Into.Clear();
            this.Values.Clear();
            this.Terminator.Clear();
        }

        public override SqlStatement Clone()
        {
            var result = new SqlInsertStatement()
            {
                _text = _text,
                Table = this.Table.Clone(),
                Into = this.Into.Clone(),
                Values = this.Values.Clone(),
                Terminator = this.Terminator.Clone()
            };

            return result;
        }
    }
}
